dojo.require("dojox.charting.Chart2D");
dojo.require("dojox.charting.plot2d.Pie");
dojo.require("dojox.charting.action2d.Highlight");
dojo.require("dojox.charting.action2d.MoveSlice");
dojo.require("dojox.charting.action2d.Tooltip");
dojo.require("dojox.charting.themes.MiamiNice");
dojo.require("dojox.charting.themes.Tom");
dojo.require("dojox.charting.widget.Legend");

dojo.addOnLoad(function() {
    var dc = dojox.charting;
    var chartTwo = new dc.Chart2D("chartTwo");
    chartTwo.setTheme(dc.themes.MiamiNice).addPlot("default", {
        type: "Pie",
        font: "normal normal 11pt Tahoma",
        fontColor: "black",
        labelOffset: -30,
        radius: 70
    }).addSeries("Series A", [{
        y: 4,
        text: "Red",
        stroke: "black",
        tooltip: "Red is 50%"
    },
    {
        y: 2,
        text: "Green",
        stroke: "black",
        tooltip: "Green is 25%"
    },
    {
        y: 1,
        text: "Blue",
        stroke: "black",
        tooltip: "I am feeling Blue!"
    },
    {
        y: 1,
        text: "Other",
        stroke: "black",
        tooltip: "Mighty <strong>strong</strong><br>With two lines!"
    }]);
    var anim_a = new dc.action2d.MoveSlice(chartTwo, "default");
    var anim_b = new dc.action2d.Highlight(chartTwo, "default");
    var anim_c = new dc.action2d.Tooltip(chartTwo, "default");
    chartTwo.render();
    var legendTwo = new dojox.charting.widget.Legend({chart: chartTwo},"legendTwo");


    // Define the data
    var chartData = [10000,9200,11811,12000,7662,13887,14200,12222,12000,10009,11288,12099];
    // Create the chart within it's "holding" node
    var chart = new dojox.charting.Chart2D("chartNode");
    // Set the theme
    chart.setTheme(dojox.charting.themes.Tom);

    // Add the only/default plot
    chart.addPlot("default", {
        type: "Lines",
        markers: true
    });

    // Add axes
    chart.addAxis("x");
    chart.addAxis("y", { min: 5000, max: 15000, vertical: true, fixLower: "major", fixUpper: "major" });
    // Add the series of data
    chart.addSeries("SalesThisDecade",chartData);
    // Render the chart!
    chart.render();
});